<template>
  <div class="home">
    <el-container>
      <el-header>
        <div class="left">后台管理系统</div>
        <div class="right">
          <el-button type="danger" size="20" @click="logout()">退出</el-button>
        </div>
      </el-header>
      <el-container class="v-container">
        <el-aside style="width: 120px">
          <div>
            <router-link to="/manageuser">用户管理</router-link>
          </div>
          <div>
            <router-link to="/manageschool">学校管理</router-link>
          </div>
          <div>
            <router-link to="/manageblock">街区管理</router-link>
          </div>
        </el-aside>
        <el-main>
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  methods: {
    logout() {
      this.$confirm("你是否要退出?", "登出", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          setTimeout(() => {
            this.$router.push("/admin");
            window.location.reload();
          }, 500);
        })
        .catch((err) => err);
    },
  },
};
</script>

<style lang="scss" scoped>
.home {
  height: 100%;
}
.el-container {
  height: 100%;
}
.v-container {
  height: calc(100% - 60px);
}
.el-header {
  padding: 0;
  z-index: 9;
  background-color: #00bfff;
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  box-shadow: 0 2px 5px #00bfff;
  .left {
    height: 100%;
    text-align: center;
    font-size: 35px;
    color: #fff;
    line-height: 60px;
    margin-left: 20px;
    text-shadow: 10px 10px rgba(25, 255, 255, 0.3);
  }
  .right {
    display: flex;
    align-items: center;
  }
}
.el-aside {
  width: 200px;
  height: 100%;
  background-color: #00bfff;
  color: #fff;
  font-size: 20px;
  div {
    border: 1px solid #fff;
    height: 40px;
    text-align: center;
    line-height: 40px;
  }
}
.el-main {
  height: 100%;
  background-color: #fff;
}
</style>
